package edu.fim.data.dao;

import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import javax.sql.DataSource;


public abstract class AbstractDAO<T, ID extends Serializable> implements DAO<T, ID> {

	private DataSource dataSource;
	// TODO: protected final EntityManager entityManager;

	protected AbstractDAO(DataSource dataSource) {
		this.dataSource = dataSource;
	}

	protected DataSource getDataSource() {
		return dataSource;
	}

	protected PreparedStatement prepareStatement(String sql) throws SQLException {
		return dataSource.getConnection().prepareStatement(sql);
	}
}